package demo09_BlockingQueue;

import java.util.concurrent.ArrayBlockingQueue;

/**
 * @author kunkun
 * @className Test01_Exception
 * @Description 抛出异常
 * @date 2025/3/6 13:54
 */
public class Test01_Exception {

    public static void main(String[] args) {
        ArrayBlockingQueue<Object> queue = new ArrayBlockingQueue<>(2);

        //1. 新增
        queue.add("a");
        queue.add("b");
        //queue.add("c");     //Queue full
        System.out.println(queue.element());

        //3. 移除
        queue.remove();
        queue.remove();
//        queue.remove();     //Queue empty
        System.out.println(queue.element());    //Queue empty
    }




}
